
<!DOCTYPE html>
<html>
<head>
  <base href="https://cdn.h5case.com.cn/case/people-cn/v-1.0.2/fu/">
  <meta charset="utf-8">

  <title>送你一个“中国福”</title>

  <!--http://www.html5rocks.com/en/mobile/mobifying/-->
  <meta name="viewport"
        content="width=device-width,user-scalable=no,initial-scale=1, minimum-scale=1,maximum-scale=1"/>

  <!--https://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html-->
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  <meta name="format-detection" content="telephone=no">

  <!-- force webkit on 360 -->
  <meta name="renderer" content="webkit"/>
  <meta name="force-rendering" content="webkit"/>
  <!-- force edge on IE -->
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
  <meta name="msapplication-tap-highlight" content="no">

  <!-- force full screen on some browser -->
  <meta name="full-screen" content="yes"/>
  <meta name="x5-fullscreen" content="true"/>
  <meta name="360-fullscreen" content="true"/>
  
  <!-- force screen orientation on some browser -->
  <meta name="screen-orientation" content=""/>
  <meta name="x5-orientation" content="">

  <!--fix fireball/issues/3568 -->
  <!--<meta name="browsermode" content="application">-->
  <meta name="x5-page-mode" content="app">

  <!--<link rel="apple-touch-icon" href=".png" />-->
  <!--<link rel="apple-touch-icon-precomposed" href=".png" />-->

  <link rel="stylesheet" type="text/css" href="style-mobile.css"/>

</head>
<body style="background:#c92f2d; ">
  <canvas id="GameCanvas" oncontextmenu="event.preventDefault()" tabindex="0" style="background: #c92f2d;opacity: 0;"></canvas>
  <div id="splash" style="opacity: 0;">
    <div class="progress-bar stripes">
      <span style="width: 0%"></span>
    </div>
  </div>
<audio id="bgmusic" autoplay preload loop="loop" src="bg.mp3"></audio>
<script src="src/settings.js" charset="utf-8"></script>
<script src="jquery.js" charset="utf-8"></script>
<script src="qrcode.js" charset="utf-8"></script>
<script src="bridge.js" charset="utf-8"></script>
<script>
  if (navigator.userAgent.toLowerCase().match(/MicroMessenger/i) == 'micromessenger') {
      window.plat = 'wx';
  } else if (navigator.userAgent.indexOf("DailyNewspaper") > -1){
      window.plat = 'app';
  } else {
      window.plat = 'other';
  }
  if (window.plat === 'app') {
      if (Bridge) {
        Bridge.request('getUserInfor', {}, 'getappUserSuccess', 'getappUserError');
      }
  }
  window.getappUserSuccess = (res) => {
      if (typeof res !== 'object') {
        window.appUser = JSON.parse(res);
        window.appUserAvatar = window.appUser.avatar;
      }
  };
  window.getappUserError = (error) => {
  };
</script>

<script type="text/javascript">

  (function () {
      var BlobConstructor = ((function () {
          try {
              new Blob();
              return true;
          } catch (e) {
              return false;
          }
      })()) ? window.Blob : function (parts, opts) {
          var bb = new (
              window.BlobBuilder
              || window.WebKitBlobBuilder
              || window.MSBlobBuilder
              || window.MozBlobBuilder
          );
          parts.forEach(function (p) {
              bb.append(p);
          });
          return bb.getBlob(opts ? opts.type : undefined);
      };
      // Android上的AppleWebKit 534以前的内核存在一个Bug，
      // 导致FormData加入一个Blob对象后，上传的文件是0字节
      function hasFormDataBug() {
          var bCheck = ~navigator.userAgent.indexOf('Android')
              && ~navigator.vendor.indexOf('Google')
              && !~navigator.userAgent.indexOf('Chrome');
          // QQ X5浏览器也有这个BUG
          return bCheck && navigator.userAgent.match(/AppleWebKit\/(\d+)/).pop() <= 534 || /MQQBrowser/g.test(navigator.userAgent);
      }
      var FormDataShim = (function () {
          var formDataShimNums = 0;
          return function FormDataShim() {
              var
                  // Store a reference to this
                  o = this,
                  // Data to be sent
                  parts = [],
                  // Boundary parameter for separating the multipart values
                  boundary = Array(21).join('-') + (+new Date() * (1e16 * Math.random())).toString(36),
                  // Store the current XHR send method so we can safely override it
                  oldSend = XMLHttpRequest.prototype.send;
              this.getParts = function () {
                  return parts.toString();
              };
              this.append = function (name, value, filename) {
                  parts.push('--' + boundary + '\r\nContent-Disposition: form-data; name="' + name + '"');
                  if (value instanceof Blob) {
                      parts.push('; filename="' + (filename || 'blob') + '"\r\nContent-Type: ' + value.type + '\r\n\r\n');
                      parts.push(value);
                  }
                  else {
                      parts.push('\r\n\r\n' + value);
                  }
                  parts.push('\r\n');
              };
              formDataShimNums++;
              XMLHttpRequest.prototype.send = function (val) {
                  var fr,
                      data,
                      oXHR = this;
                  if (val === o) {
                      // Append the final boundary string
                      parts.push('--' + boundary + '--\r\n');
                      // Create the blob
                      data = new BlobConstructor(parts);
                      // Set up and read the blob into an array to be sent
                      fr = new FileReader();
                      fr.onload = function () {
                          oldSend.call(oXHR, fr.result);
                      };
                      fr.onerror = function (err) {
                          throw err;
                      };
                      fr.readAsArrayBuffer(data);
                      // Set the multipart content type and boudary
                      this.setRequestHeader('Content-Type', 'multipart/form-data; boundary=' + boundary);
                      formDataShimNums--;
                      if (formDataShimNums == 0) {
                          XMLHttpRequest.prototype.send = oldSend;
                      }
                  }
                  else {
                      oldSend.call(this, val);
                  }
              };
          };
      })();
      window.BlobFormDataShim = {
          Blob: BlobConstructor,
          FormData: hasFormDataBug() ? FormDataShim : FormData
      };
  })();
  window.uploadToQiniu = function(blobOrBase64, successCb, errorCb, options) {
      var base64ToBlob = function (base64) {
          for (var b = window.atob(base64.split(",")[1]), c = new ArrayBuffer(b.length), d = new Uint8Array(c), e = 0; e < b.length; e++) {
              d[e] = b.charCodeAt(e);
          }
          return new Blob([c], {
              type: "image/png"
          });
      };
      var bucket = options && options['bucket'] ? options['bucket'] : 'h5case-com-cn';
      $.ajax({
          type: "get",
          url: "https://www.html5case.com.cn/QiniuClient/getTokenByBucket?bucket=" + encodeURIComponent(bucket),
          dataType: "json",
          success: function (data) {
              var formData = new FormData();
              if (window.Blob && blobOrBase64 instanceof window.Blob) {
                  formData.append('file', blobOrBase64);
              } else {
                  formData.append('file', base64ToBlob(blobOrBase64));
              }
              formData.append('detectMime', 1);
              formData.append('token', data.uptoken);
              var xhr = new XMLHttpRequest();
              xhr.open('POST', 'https://upload.qiniu.com/');
              xhr.onreadystatechange = function (response) {
                  if (xhr.readyState == 4 && xhr.status == 200 && xhr.responseText != "") {
                      var upload_data = JSON.parse(xhr.responseText);
                      if (upload_data && upload_data.key) {
                          var resourceBaseUrl = options && options['baseUrl'] ? options['baseUrl']
                              : 'https://cdn.h5case.com.cn/';
                          var url = resourceBaseUrl + upload_data.key;
                          if (successCb) successCb(url, upload_data);
                      } else {
                          if (errorCb) errorCb(xhr);
                      }
                  }
              };
              xhr.onerror = function () {
                  errorCb(xhr);
                  console.log("base64:")
                  console.log(blobOrBase64.slice(0, 100))
                  console.log("uptoken:")
                  console.log(data.uptoken)
              };
              xhr.send(formData);
          },
          error: function (jqXHR) {
              errorCb(jqXHR);
          }
      });
  }
  window.uploadTextToQiniu = function(text, successCb, errorCb, options) {
      var base64ToBlob = function (base64) {
          for (var b = window.atob(base64.split(",")[1]), c = new ArrayBuffer(b.length), d = new Uint8Array(c), e = 0; e < b.length; e++) {
              d[e] = b.charCodeAt(e);
          }
          return new Blob([c], {
              type: "image/png"
          });
      };
      var ia = new Uint8Array(text.length);
      for (var i = 0; i < text.length; i++) {
          ia[i] = text.charCodeAt(i);
      }
      var file = new BlobFormDataShim.Blob([ia.buffer], {type: 'text'});
      var bucket = options && options['bucket'] ? options['bucket'] : 'h5case-com-cn';
      $.ajax({
          type: "get",
          url: "https://www.html5case.com.cn/QiniuClient/getTokenByBucket?bucket=" + encodeURIComponent(bucket),
          dataType: "json",
          success: function (data) {
              var formData = new BlobFormDataShim.FormData();
              formData.append('file', file);
              formData.append('detectMime', 1);
              formData.append('token', data.uptoken);
              var xhr = new XMLHttpRequest();
              xhr.open('POST', 'https://upload.qiniu.com/');
              xhr.onreadystatechange = function (response) {
                  if (xhr.readyState == 4 && xhr.status == 200 && xhr.responseText != "") {
                      var data = JSON.parse(xhr.responseText);
                      if (data && data.key) {
                          var resourceBaseUrl = options && options['baseUrl'] ? options['baseUrl']
                              : 'https://cdn.h5case.com.cn/';
                          var url = resourceBaseUrl + data.key;
                          if (successCb) successCb(url, data);
                      } else {
                          if (errorCb) errorCb();
                      }
                  }
              };
              xhr.onerror = function () {
                  errorCb();
              };
              xhr.send(formData);
          },
          error: function () {
              errorCb();
          }
      });
  }

</script>


<script type="text/javascript">
  window.userInfo_config = {
      prefix:'',
      ssoUrl:'https://sso.h5case.com.cn/Open/index',
      scope:'snsapi_userinfo',
      shareClean:true,
      appid: 'wx9ec103d70ef0c88f',
      saveAs: 'people-fu',
      wxOut:true
  };
</script>
<!-- <script src="//cdn.h5case.com.cn/h6app_userInfo.1.1.0.min.js"></script> -->
<script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>

<!-- <script src="vconsole.min.js"></script> -->
<script src="main.js" charset="utf-8"></script>

<!-- <span style="display:none;"><script type="text/javascript" src="https://s23.cnzz.com/z_stat.php?id=1276074096&web_id=1276074096"></script></span> -->

<script>
    window.platform = [
        {"name": "_czc", "id": "1273328024"}, //name,统计平台名称；id：统计平台id
    ];
    window.h6app_shareConfig = {
        'shareData': {
            title: '快签收我为你写的“中国福”，气质神似王羲之',
            desc: '来看看你的书法气质像谁',
            imgUrl: 'https://www.html5case.com.cn/case/people-cn/fu/timg.jpg',
            link: "https://www.html5case.com.cn/case/people-cn/fu/"
        },
        'timeLineTitle': '快签收我为你写的“中国福”，气质神似王羲之', //选填，朋友圈标题，未填写将会取值
        'timeLineImgUrl': '', //选填，朋友圈图⽚信息，未填写将会取值shareData.imgUrl
        success: function () { //分享成功回调
        },
        cancel: function () { //分享取消回调
        },
        fromGroup: "group", //选填，统计来源群组名称，默认为 来⾃微信群
        fromSingle: "", //选填，统计来源好友名称，默认为 来⾃好友
        fromTimline: "", //选填，统计来源空间名称，默认为 来⾃朋友圈
        toFriend: "", //选填，统计分享到好友和群组名称，默认为 好友和群组
        toTimeLine: "", //选填，统计分享到QQ空间名称，默认为 朋友圈
    };
    //重置分享配置
    // window.h6app_shareConfig.shareData.link="https://www.html5case.com.cn/case/cmbchina/1";
    window.setShareData &&　window.setShareData();
</script>
<script type="text/javascript" src="//cdn.h5case.com.cn/h6app_jssdk.1.0.min.js"></script>


<script type="text/javascript">
(function () {
    // open web debugger console
    if (typeof VConsole !== 'undefined') {
        window.vConsole = new VConsole();
    }

    var splash = document.getElementById('splash');
    splash.style.display = 'block';

    var cocos2d = document.createElement('script');
    cocos2d.async = true;
    cocos2d.src = window._CCSettings.debug ? 'cocos2d-js.js' : 'cocos2d-js-min.js';

    var engineLoaded = function () {
        document.body.removeChild(cocos2d);
        cocos2d.removeEventListener('load', engineLoaded, false);
        window.boot();
    };
    cocos2d.addEventListener('load', engineLoaded, false);
    document.body.appendChild(cocos2d);
})();
</script>
<script>
    document.addEventListener('DOMContentLoaded', function () {
        function audioAutoPlay() {
            var audio_ = document.getElementById('bgmusic');
            audio_.volume = 0.5;
            audio_.play();
            document.addEventListener("WeixinJSBridgeReady", function () {
                audio_.play();
            }, false);
        }
        audioAutoPlay();
    });
    wx.ready(function () {
        document.getElementById('bgmusic').play();
    });
</script>
</body>
</html>
